package com.mjl.shops.adapter;

import android.graphics.Color;
import android.view.View;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.mjl.shops.R;
import com.mjl.shops.bean.CollatorLeftBean;
import com.mjl.shops.utils.StringUtils;

import java.util.List;

public class CollatorLeftAdapter extends BaseQuickAdapter<CollatorLeftBean, BaseViewHolder> {

    public CollatorLeftAdapter(int layoutResId, @Nullable List<CollatorLeftBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, CollatorLeftBean item) {

        TextView t = helper.getView(R.id.collator_name_tv);
        if (StringUtils.strEmpty(item.getCollatorName())){
            t.setText(item.getCollatorName());
        }else{
            t.setText("未知");
        }

        if (item.getCollatorSelect() == 1){
            helper.getView(R.id.lin_tag_tv).setVisibility(View.VISIBLE);
            t.setTextColor(Color.parseColor("#000000"));
            helper.setBackgroundColor(R.id.left_collator_bg,Color.parseColor("#FFFFFF"));

        }else{
            helper.getView(R.id.lin_tag_tv).setVisibility(View.INVISIBLE);
            t.setTextColor(Color.parseColor("#999999"));
            helper.setBackgroundColor(R.id.left_collator_bg,Color.parseColor("#F3F3F3"));
        }


    }
}
